package com.hopu.dy.mapper;
import com.hopu.dy.pojo.Person;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface PingLunMapper {
    //查询所有评论
    @Select("select * from t_pinglun")
    List<Person> select();

    // 添加评论
    @Insert("INSERT INTO t_pinglun(image, name, comment_time, comment_content, love, shipin_id) " +
            "VALUES(#{image}, #{name},NOW(), #{commentContent}, #{love}, #{shiPinId})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int insert(Person person);
    //点赞
    @Update("UPDATE t_pinglun SET love = love + 1 WHERE id = #{id}")
    int incrementLove(long id);
}
